Pod::Spec.new do |s|
  s.name             = 'YLPaymentKit'
  s.version          = '1.0.1'
  s.summary          = '统一支付处理框架'
  s.description      = '支持多种支付方式的统一处理框架，包括Apple IAP、支付宝支付、微信支付等。'
  s.homepage         = 'https://gitee.com/hechangVip/YLPaymentKit'
  s.license          = { :type => 'MIT', :text => 'Copyright (c) 2024 hechang <hechang@youloft.com>' }
  s.author           = { 'hechang' => 'hechang@youloft.com' }
  s.source           = { :git => 'https://gitee.com/hechangVip/YLPaymentKit.git', :tag => s.version.to_s }
  
  s.ios.deployment_target = '13.0'
  s.swift_version = '5.0'
  s.static_framework = true
  
  s.source_files = 'YLPaymentDemo/YLPaymentKit/**/*.{swift,h,m}', 'YLPaymentDemo/YLPaymentKit/YLPaymentKit.h'

  s.public_header_files = 'YLPaymentDemo/YLPaymentKit/YLPaymentKit.h'
  
  # 核心模块
  s.subspec 'Core' do |ss|
    # 确保这里的路径与实际目录结构匹配
    ss.source_files = 'YLPaymentDemo/YLPaymentKit/Core/**/*.swift',
                      'YLPaymentDemo/YLPaymentKit/Models/**/*.swift',
                      'YLPaymentDemo/YLPaymentKit/Validators/**/*.swift'
    ss.frameworks = 'Foundation'
  end
  
  # 内购模块
  s.subspec 'IAP' do |ss|
    ss.dependency 'YLPaymentKit/Core'
    ss.source_files = 'YLPaymentDemo/YLPaymentKit/StoreKit/**/*.swift',
                      'YLPaymentDemo/YLPaymentKit/Processors/IAP/**/*.swift'
    ss.frameworks = 'StoreKit'
  end
  
  # 支付宝模块
  s.subspec 'Alipay' do |ss|
    ss.dependency 'YLPaymentKit/Core'
    ss.dependency 'AlipaySDK-iOS'
    ss.source_files = 'YLPaymentDemo/YLPaymentKit/Processors/Alipay/**/*.swift'
    ss.frameworks = 'UIKit', 'Foundation'
  end
  
  # 微信模块
  s.subspec 'WeChat' do |ss|
    ss.source_files = 'YLPaymentDemo/YLPaymentKit/Processors/Wechat/**/*.{swift,h,m}'
    ss.dependency 'WechatOpenSDK'
    ss.dependency 'YLPaymentKit/Core'  # 添加对Core子模块的依赖
  end
  
  # 默认包含核心模块和内购模块
  s.default_subspec = 'Core', 'IAP'
end
